package org.penguin.study.bk.controller

import org.penguin.study.bk.base.api.Return
import org.penguin.study.bk.entity.Order
import org.penguin.study.bk.service.CompletableFutureService
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

import javax.annotation.Resource

@RestController
@RequestMapping("/order")
class CompletableFutureController {

    @Resource
    private lateinit var completableFutureService: CompletableFutureService

    @PostMapping("/create")
    fun createOrder(@RequestBody order: Order) = Return.ok<String>(completableFutureService.createOrder(order))
}
